home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d15 / hotwords.arc / HOTWORDS.TBK (.txt) next >
Asymetrix ToolBook File  |  1990-10-26  |  38KB  |  744 lines

  1. pBackFields
  2. pMainMenu
  3. System
  4. Tms Rmn
  5. `D|D|
  6. sizetopage
  7. Tms Rmn
  8. `D|D|
  9. }`D|D|
  10. }`D|D|
  11. Dynamic Hotwords
  12. enterbook
  13. enterbook
  14. sizetopage
  15. ;IshowHotwords
  16. reader
  17.  field id 5 of page id 3 ,field id 35 of page id 3,field id 36 of page id 3,field id 37 of page id 3
  18. System
  19. General
  20. "pGenRemarks" 
  21. buttonUp
  22. buttonUp
  23. pGenRemarks
  24. Some general remarks about hotwords....
  25. RFields
  26. "pRecordFields" 
  27. buttonUp
  28. buttonUp
  29. pRecordFields
  30. Hotwords in Record Fields...
  31. FgFields
  32. "pForegroundFields" 
  33. buttonUp
  34. buttonUp
  35. pForegroundFields
  36. Hotwords in Foreground Fields...
  37. The Hotword Book
  38. RFields
  39. "pBackFields" 
  40. buttonUp
  41. buttonUp
  42. pBackFields
  43. Hotwords in Background Fields...
  44. pMainMenu
  45. The Hotword Book
  46. pGenRemarks
  47.      One of the more useful features of OpenScript is the ability to create objects "on the fly", that is, from scripts as they execute. Among the objects that can be created from a script are hotwords, essential to any serious hypermedia application. Many of our users want to (for example) open a text file, read it into fields, search for certain words or phrases, and create links to other pages. This is complicated by problems in "finding" hotwords immediately after their creation. The purpose of this book is to provide working examples of dynamic creation of hotwords in each of the three types of fields in Toolbook. 
  48.      In order to understand the care and feeding of hotword objects, we need to understand the nature of their habitat, the Toolbook field. There are three types of Toolbook field: foreground, background, and record fields. Toolbook field objects(taken together) have one great strength and one great weakness. Their strength lies in the fact that the field types have unique features, and can complement their cousins if used right. Their  weakness lies in the fact each each field type has unique features, and must be handled in a unique manner.
  49.      The principal difference between field types is the location of their text. The text in a background field lives in the background with the field. This is useful for header lines and titles where the text does not change from page to page; for example, the title "The Hotword Book" at the top of this page is in a background field.  The text of record fields, on the other hand, lives in the foreground, while the recordfield itself lives on the background. This is useful for preparing blank forms, where the overall format is the same on each page, but the text entered on each page will change. 
  50.       Problems arise when users look for hotwords in the wrong place. This is compounded by the fact that some hotwords "move" as they are created, so they cannot be found in the same place as their text!  This book is organized along the lines of field types -one page, one field type. This is no accident. Each page contains a valid reference to a hotword of that field type. 
  51.       
  52. ick cribsheet, look at the "HotHandle" field on each page. 
  53.       
  54. e you have a handle on the hotwords, you have several tools available for accessing them. 
  55. MainMenu
  56. pMainMenu
  57. buttonUp
  58. buttonUp
  59. pMainMenu
  60. Main Menu
  61. fGenRemarks
  62. The Hotword Book
  63. pRecordFields
  64. This is RecordField "RecField1".  Although  the recordfield is in the background, the text lives in the foreground, and the hotwords are objects of this recordfield of either the page or background. 
  65. bCreateHw
  66. fScripts 
  67. storage
  68. "RecField1"
  69. buttonUp
  70. buttonUp
  71. RecField1
  72. hotword
  73. GRcreateHotword
  74. RecField1
  75. Create Hotwords
  76. bDestroyHW
  77. RecField1 
  78. fScripts 
  79. storage
  80. RecordField 
  81. Recordfield 
  82. buttonUp
  83. buttonUp
  84. hotword
  85. gremoveHotword
  86. hotword
  87. gremoveHotword
  88. storage
  89. fScripts
  90. RecField1
  91. Destroy Hotwords
  92. fScripts
  93. opartner
  94. ocohort
  95. orival
  96. buttonUp
  97. buttonUp
  98. partner
  99. cohort
  100. rival
  101. cohort
  102. button id 34 of page id 3
  103. partner
  104. button id 33 of page id 3
  105. rival
  106. field id 37 of page id 3
  107. to handle buttonUp 
  108.     set syslockscreen to true
  109.     --put text of field fScripts into storage
  110.     --set text of field fScripts to null
  111.     search page records for "RecField1"
  112.     if selection contains "hotword"
  113.         set name of selection to selectedText
  114.         break to system
  115.     end
  116.     send createHotword
  117.     get objects of recordField RecField1 of this page
  118.     set name of last item of it to selectedText
  119.     set activated of recordField RecField1 to true
  120.     --put storage into text of field fScripts
  121. Scripts
  122. opartner 
  123. BbCreateHW 
  124. orival
  125. ocohort
  126. buttonUp
  127. buttonUp
  128. partner
  129. partner
  130. rival
  131. cohort
  132. bCreateHW
  133. partner
  134. field id 5 of page id 3
  135. rival
  136. field id 37 of page id 3
  137. cohort
  138. button id 34 of page id 3
  139. Scripts
  140. remarks
  141. opartner 
  142. orival
  143. ocohort
  144. buttonUp
  145. buttonUp
  146. partner
  147. rival
  148. cohort
  149. cohort
  150. button id 33 of page id 3
  151. partner
  152. field id 37 of page id 3
  153. rival
  154. field id 5 of page id 3
  155. Remarks
  156. fScripts
  157. opartner
  158. orival
  159. buttonUp
  160. buttonUp
  161. partner
  162. rival
  163. partner
  164. button id 3 of page id 2
  165. rival
  166. field id 31 of page id 2
  167. to handle buttonUp 
  168.     set syslockscreen to true
  169.     put text of field fScripts into storage
  170.     set text of field fScripts to null
  171.     search page for "ForeField1"
  172.     if selection contains "hotword"
  173.         set name of selection to selectedText
  174.         break to system
  175.     end
  176.     send createHotword
  177.     get objects of field ForeField1 of this page
  178.     set name of last item of it to selectedText
  179.     set activated of field ForeField1 to true
  180.     put storage into text of field fScripts
  181. remarks
  182. opartner
  183. ocohort
  184. orival
  185. buttonUp
  186. buttonUp
  187. partner
  188. cohort
  189. rival
  190. cohort
  191. button id 33 of page id 3
  192. rival
  193. field id 5 of page id 3
  194. partner
  195. button id 34 of page id 3
  196. This is the text
  197. MainMenu
  198. pMainMenu
  199. buttonUp
  200. buttonUp
  201. pMainMenu
  202. Main Menu
  203. MainMenu
  204. pMainMenu
  205. buttonUp
  206. buttonUp
  207. pMainMenu
  208. Main Menu
  209. The Hotword Book
  210. RecField1
  211. pRecordFields
  212. This is RecordField "RecField1".  Although  the recordfield is in the background, the text lives in the foreground, and the hotwords are objects of this recordfield of either the page or background. 
  213. bCreateHw
  214. cField1
  215. Create Hotwords
  216. bDestroyHW
  217. RecField1 
  218. fScripts 
  219. storage
  220. RecordField 
  221. Recordfield 
  222. buttonUp
  223. buttonUp
  224. hotword
  225. gremoveHotword
  226. hotword
  227. gremoveHotword
  228. storage
  229. fScripts
  230. RecField1
  231. Destroy Hotwords
  232. fScripts
  233. opartner
  234. ocohort
  235. orival
  236. buttonUp
  237. buttonUp
  238. partner
  239. cohort
  240. rival
  241. cohort
  242. button id 34 of page id 3
  243. partner
  244. button id 33 of page id 3
  245. rival
  246. field id 37 of page id 3
  247. --Hide the gory details 
  248. --Search 
  249. "RecField1"
  250. --Is 
  251. already a 
  252. --If so, quit early
  253. --If you got 
  254. far, there 
  255. --so create one
  256. --Get a 
  257. . See "remarks" 
  258. --Activate 
  259. scripts so 
  260. works OK
  261. buttonUp
  262. buttonUp
  263. RecField1
  264. hotword
  265. GRcreateHotword
  266. RecField1
  267.  fScripts
  268. Scripts
  269. opartner 
  270. BbCreateHW 
  271. orival
  272. ocohort
  273. buttonUp
  274. buttonUp
  275. partner
  276. partner
  277. rival
  278. cohort
  279. bCreateHW
  280. partner
  281. field id 5 of page id 3
  282. rival
  283. field id 37 of page id 3
  284. cohort
  285. button id 34 of page id 3
  286. Scripts
  287. remarks
  288. opartner 
  289. orival
  290. ocohort
  291. buttonUp
  292. buttonUp
  293. partner
  294. rival
  295. cohort
  296. cohort
  297. button id 33 of page id 3
  298. partner
  299. field id 37 of page id 3
  300. rival
  301. field id 5 of page id 3
  302. Remarks
  303. fScripts
  304. opartner
  305. orival
  306. buttonUp
  307. buttonUp
  308. partner
  309. rival
  310. partner
  311. button id 3 of page id 2
  312. rival
  313. field id 31 of page id 2
  314. to handle buttonUp 
  315.     set syslockscreen to true
  316.     put text of field fScripts into storage
  317.     set text of field fScripts to null
  318.     search page for "ForeField1"
  319.     if selection contains "hotword"
  320.         set name of selection to selectedText
  321.         break to system
  322.     end
  323.     send createHotword
  324.     get objects of field ForeField1 of this page
  325.     set name of last item of it to selectedText
  326.     set activated of field ForeField1 to true
  327.     put storage into text of field fScripts
  328. remarks
  329. opartner
  330. ocohort
  331. orival
  332. buttonUp
  333. buttonUp
  334. partner
  335. cohort
  336. rival
  337. cohort
  338. button id 33 of page id 3
  339. rival
  340. field id 5 of page id 3
  341. partner
  342. button id 34 of page id 3
  343. The text of record fields, lik
  344. MainMenu
  345. pMainMenu
  346. buttonUp
  347. buttonUp
  348. pMainMenu
  349. Main Menu
  350. to handle buttonUp 
  351.     --Hide the gory details from the user
  352.     set syslockscreen to true
  353.     --Search for the text string, select it
  354.     search page records for "RecField1"
  355.     --Is it already a hotword?
  356.     --If so, quit early
  357.     if selection contains "hotword"
  358.         break to system
  359.     end
  360.     --If you got this far, there is no hotword, 
  361.     --so create one
  362.     send createHotword
  363.     --Get a handle of the hotword. See "remarks" field!
  364.     get objects of recordField RecField1 of this page
  365.     set name of last item of it to selectedText
  366.     --Activate the scripts so it works OK
  367.     set activated of recordField RecField1 to true
  368. The text of record fields, like that of foreground fields, resides in the foreground. Here the text is selected through a search, checked to see if it is already a hotword, and a hotword is created if one does not already exist. The newly minted hotword is named immediately after its creation. The hotword is an object of the recordfield, whether it is addressed by name or simply as objects of a specific recordfield. For example, if the hotword was named "Barney" and the recordfield was named "Rubble" the hotword could be found as any one of: objects of recordfield Rubble or hotword Barney of this page.or hotword Barney ofage, 
  369. The Hotword Book
  370. backField1
  371. This is background field BackField1.  The text for this field is in the background, along with the field. Hotwords in this field are objects of this field of this background. 
  372. ckField1
  373. partner
  374. rival
  375. cohort
  376. rival
  377. field id 5 of page id 6
  378. partner
  379. field id 6 of page id 6
  380. cohort
  381. button id 3 of page id 6
  382. Remarks
  383. fScripts
  384. opartner
  385. ocohort
  386. orival
  387. buttonUp
  388. buttonUp
  389. partner
  390. cohort
  391. rival
  392.     rival
  393. field id 6 of page id 6
  394.     partner
  395. button id 3 of page id 6
  396.     cohort
  397. button id 4 of page id 6
  398. to handle buttonUp 
  399.     set syslockscreen to true
  400.     set selection to null
  401.     send author
  402.     send background
  403.     --put text of field fScripts into storage
  404.     --set text of field fScripts to null
  405.     search page for "BackField1"
  406.     if selection contains "hotword"
  407.         set name of selection to selectedText
  408.         break to system
  409.     end
  410.     send createHotword
  411.     get objects of Field BackField1 of this background
  412.     set name of last item of it to selectedText
  413.     send reader
  414.     --put storage into text of field fScripts
  415. remarks
  416. opartner
  417. ocohort
  418. orival
  419. buttonUp
  420. buttonUp
  421. partner
  422. cohort
  423. rival
  424. partner
  425. button id 4 of page id 6
  426. rival
  427. field id 5 of page id 6
  428. cohort
  429. button id 3 of page id 6
  430. This is the text
  431. MainMenu
  432. pMainMenu
  433. buttonUp
  434. buttonUp
  435. pMainMenu
  436. Main Menu
  437. partner
  438. button id 4 of page id 6
  439. rival
  440. field id 5 of page id 6
  441. cohort
  442. button id 3 of page id 6
  443. This is the text
  444. MainMenu
  445. pMainMenu
  446. buttonUp
  447. buttonUp
  448. pMainMenu
  449. Main Menu
  450. pGenRemarks
  451. pForegroundFields
  452. pRecordFields
  453. B    HA@
  454. >2bdaR
  455. pForegroundFields
  456. bCreateHw
  457. --Look 
  458. "ForeField1"
  459. --Is 
  460. already a 
  461. ? If so, quit early
  462. --If you got 
  463. far, 
  464. --so 
  465. --Get 
  466. --See 
  467. "remarks" about 
  468. --The 
  469. must be 
  470. work OK
  471. --Put 
  472. stuff 
  473. display 
  474. fScripts 
  475. buttonUp
  476. buttonUp
  477. ForeField1
  478. hotword
  479. GRcreateHotword
  480. fScripts
  481. ForeField1
  482. Create Hotwords
  483. bDestroyHW
  484. forefield1 
  485. fScripts 
  486. storage
  487. ForeField1 
  488. buttonUp
  489. buttonUp
  490. ForeField1
  491. hotword
  492. ForeField1
  493. gremoveHotword
  494. ForeField1
  495. hotword
  496. gremoveHotword
  497. storage
  498. fScripts
  499. forefield1
  500. Destroy Hotwords
  501. Scripts
  502. opartner 
  503. BbCreateHW 
  504. orival
  505. ocohort
  506. buttonUp
  507. buttonUp
  508. partner
  509. partner
  510. rival
  511. cohort
  512. bCreateHW
  513. cohort
  514. button id 30 of page id 2
  515. rival
  516. field id 31 of page id 2
  517. partner
  518. field id 5 of page id 2
  519. Scripts
  520. ForeField1
  521. This is foreground field "ForeField1". The text of this field lives on the page(that is, the foreground).  A hotword in this field is an object of the field. f field 
  522. fScripts
  523. opartner
  524. orival
  525. buttonUp
  526. buttonUp
  527. partner
  528. rival
  529.     rival
  530. field id 31 of page id 2
  531.     partner
  532. button id 3 of page id 2
  533. to handle buttonUp 
  534.     set syslockscreen to true
  535.     --Look for the search string
  536.     search page for "ForeField1"
  537.     --Is it already a hotword? If so, quit early
  538.     if selection contains "hotword"
  539.         break to system
  540.     end
  541.     --If you got this far, the text is not a hotword, 
  542.     --so make one
  543.     send createHotword
  544.     --Get the handle to the hotword. 
  545.     --See the "remarks" about this!
  546.     get objects of field ForeField1 of this page
  547.     set name of last item of it to selectedText
  548.     --The script of a foreground field must be 
  549.     --activated for the hotword to work OK
  550.     set activated of field ForeField1 to true
  551.     --Put this stuff into the display field 
  552.     set text of field fScripts to my script
  553. Scripts
  554. "fScripts" 
  555. BbCreateHW 
  556. B"remarks"
  557. buttonUp
  558. buttonUp
  559. fScripts
  560. remarks
  561. remarks
  562. fScripts
  563. bCreateHW
  564. Scripts
  565. remarks
  566. opartner 
  567. orival
  568. ocohort
  569. buttonUp
  570. buttonUp
  571. partner
  572. rival
  573. cohort
  574. rival
  575. field id 5 of page id 2
  576. partner
  577. field id 31 of page id 2
  578. cohort
  579. button id 3 of page id 2
  580. Remarks
  581. remarks
  582. opartner
  583. orival
  584. buttonUp
  585. buttonUp
  586. partner
  587. rival
  588. partner
  589. button id 30 of page id 2
  590. rival
  591. field id 5 of page id 2
  592. The text of a foreground field lives on the page(foreground) along with the rest of the field. The hotwords are objects of the field immediately after they are created. Foreground fields are the easiest fields to handle, and should be the starting point for a beginner. As always, you must start the creation process by selecting the text you will turn into a hotword. In these scripts, this is done by executing a search for the text.  The selectedText is then the target for the message "CreateHotword". It is always a good idea to set the name of the object immediately after its creation. In order to do so, one must first get a valid handle to the new hotword, often trickiest part of the process. In this case, the expression  "objects of the field" will return a comma separated list of the objects of the field, all of which should be hotwords. Just the same, the script uses the contains operator to test that condition. The last hotword in the field will be the last object in the list. Knowing this is essential to naming the hotwords. After naming, the hotword is a hotword of the field, in addition to being an object of the page. A hotword named "Fred" in field "Flintstone" can be found as hotword Fred of field Flintstone. Since this is not the case for all types of fields, you need to be sure you know which type of field you are dealing with before you start. 
  593. MainMenu
  594. pMainMenu
  595. buttonUp
  596. buttonUp
  597. pMainMenu
  598. Main Menu
  599. reField1
  600. pBackFields
  601. bCreateHw
  602. Create Hotwords
  603. bDestroyHW
  604. fScripts 
  605. storage
  606. BackField1 
  607. buttonUp
  608. buttonUp
  609. author
  610. background
  611. hotword
  612. gremoveHotword
  613. reader
  614. hotword
  615. gremoveHotword
  616. reader
  617. BackField1
  618. storage
  619. fScripts
  620. Destroy Hotwords
  621. Scripts
  622. opartner 
  623. BbCreateHW 
  624. orival
  625. ocohort
  626. buttonUp
  627. buttonUp
  628. partner
  629. partner
  630. rival
  631. cohort
  632. bCreateHW
  633. cohort
  634. button id 4 of page id 6
  635. rival
  636. field id 6 of page id 6
  637. partner
  638. field id 5 of page id 6
  639. Scripts
  640. remarks
  641. opartner 
  642. orival
  643. ocohort
  644. buttonUp
  645. buttonUp
  646. partner
  647. rival
  648. cohort
  649. rival
  650. field id 5 of page id 6
  651. partner
  652. field id 6 of page id 6
  653. cohort
  654. button id 3 of page id 6
  655. Remarks
  656. fScripts
  657. opartner
  658. ocohort
  659. orival
  660. buttonUp
  661. buttonUp
  662. partner
  663. cohort
  664. rival
  665.     rival
  666. field id 6 of page id 6
  667.     partner
  668. button id 3 of page id 6
  669.     cohort
  670. button id 4 of page id 6
  671. --Hide the gory details
  672. --You must be 
  673. ,mode 
  674. there, so:
  675. --Search 
  676. "BackField1"
  677. --If 
  678. already a 
  679. , quit early
  680. --If 
  681. far, 
  682. need 
  683. --Get a 
  684. . See 
  685. "Remarks" 
  686. --Name 
  687. critter
  688. buttonUp
  689. buttonUp
  690. author
  691. background
  692. BackField1
  693. hotword
  694. reader
  695. GRcreateHotword
  696. reader
  697. BackField1
  698. remarks
  699. opartner
  700. ocohort
  701. orival
  702. buttonUp
  703. buttonUp
  704. partner
  705. cohort
  706. rival
  707. partner
  708. button id 4 of page id 6
  709. rival
  710. field id 5 of page id 6
  711. cohort
  712. button id 3 of page id 6
  713. The field here is in the backg
  714. MainMenu
  715. pMainMenu
  716. buttonUp
  717. buttonUp
  718. pMainMenu
  719. Main Menu
  720. to handle buttonUp 
  721.     --Hide the gory details
  722.     set syslockscreen to true
  723.     --You must be in the background to select 
  724.     --text in the background, and you must be 
  725.     --in author mode to go there, so:
  726.     send author
  727.     send background
  728.     --Search for the text to select
  729.     search page for "BackField1"
  730.     --If there is already a hotword, quit early
  731.     if selection contains "hotword"
  732.         send reader
  733.         break to system
  734.     end
  735.     --If you got this far, you need to make a hotword
  736.     send createHotword
  737.     --Get a handle to the hotword. See the "Remarks" field!
  738.     get objects of Field BackField1 of this background
  739.     --Name the critter
  740.     set name of last item of it to selectedText
  741.     send reader
  742. The field here is in the background. The text is in the background, and the hotwords can be found only as objects of the field of the background. It is important to remember that you need to be on the background when you select the text in a background field. If you do not do this, you are inviting trouble! Remember, always execute send author; send background before you create a hotword on the background!
  743. word on the background!
  744.